#!/bin/bash

schoolCode=$1
pedestal=$2

# 1. 检查程序目录
if [ ! -d "/opt/wiseduAppGroups" ]; then
    mkdir -p /opt/wiseduAppGroups
    chown -R weblogic:weblogic /opt/wiseduAppGroups
fi

# 2. 初始化tomcat目录结构
mkdir -p /opt/wiseduAppGroups/$schoolCode
files=$(ls /home/commonapp/$pedestal)
for filename in $files
do
   if [ ! -d "/opt/wiseduAppGroups/$schoolCode/$filename" ]; then
       cp /home/commonapp/$pedestal/$filename -nR /opt/wiseduAppGroups/$schoolCode/
   fi
done

#4. 设置权限
chown -R weblogic:weblogic /opt/wiseduAppGroups/$schoolCode

